<template>
	<view class="content">
		<view class="index_hd">
			<!-- 导航栏 -->
			<view class="navigation">
				<view class="navigation_title">
					外卖
				</view>
			</view>
			
			<!-- 搜索区域 -->
			<view class="search" @tap="toSearch()">
				<image src="../../static/image/index/Vector.svg" mode=""></image>
				<input type="text" placeholder="输入你想要的东西" placeholder-class="placeholder">
			</view>
		</view>
		
		<!-- 主体区域 -->
		<view class="index_con">
			<!-- 分类 -->
			<view class="index_types">
				<view class="index_type" v-for="(item,index) in types" :key="index" @tap="toShopList(item)">
					<image :src="item.picUrl" mode=""></image>
					<text>{{item.name}}</text>
				</view>
			</view>
			
			<!-- 平台公告 -->
			<view class="platform_notice">
				<view class="notice_title">
					平台<text>公告</text>
				</view>
				|
				<view class="notice_content">
					这里是公告信息以及他显示的内容
				</view>
				<view class="notice_more">
					<uni-icons type="forward" size="16"></uni-icons>
				</view>
			</view>
			
			<!-- 广告 -->
			<view class="adv">
				<image src="../../static/image/index/banner.svg" mode=""></image>
			</view>
			
			<!-- 商铺 -->
			<view class="stores">
				<view class="store" v-for="(item,index) in stores" :key="index" @tap="toShopDetail(item)">
					<view class="store_img">
						<image :src="item.picUrl" mode="aspectFill"></image>
					</view>
					<view class="store_info">
						<view class="store_info_title">
							{{item.title}}
						</view>
						<view class="store_info_bd">
							<view class="store_info_score">
								{{item.score}}分
							</view>
							<view class="store_info_sale">
								月售{{item.sale}}
							</view>
						</view>
						<view class="store_info_bt">
							<view class="store_info_price">
								起送{{item.price}}
							</view>
							<view class="store_info_deliveryPrice">
								配送{{item.deliveryPrice}}
							</view>
						</view>
						<view class="store_info_distance">
							{{item.distance}}
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<tabBar current="1"></tabBar>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				types:[
					{
						picUrl:require('../../static/image/index/type1.svg'),
						name:'第一餐厅'
					},
					{
						picUrl:require('../../static/image/index/type2.svg'),
						name:'第二餐厅'
					},
					{
						picUrl:require('../../static/image/index/type3.svg'),
						name:'生鲜水果'
					},
					{
						picUrl:require('../../static/image/index/type4.svg'),
						name:'校园超市'
					},
					{
						picUrl:require('../../static/image/index/type5.svg'),
						name:'奶茶果汁'
					},
				],
				stores:[
					{
						picUrl:require('../../static/image/index/shop1.jpg'),
						title:'麻辣酸菜鱼店',
						score:'4.9',
						sale:'401',
						price:'17',
						deliveryPrice:'3',
						distance:'400m'
					},
					{
						picUrl:require('../../static/image/index/shop2.jpg'),
						title:'张亮麻辣烫店',
						score:'4.0',
						sale:'391',
						price:'15',
						deliveryPrice:'3',
						distance:'1000m'
					},
					{
						picUrl:require('../../static/image/index/shop3.jpg'),
						title:'黄焖鸡店',
						score:'4.9',
						sale:'401',
						price:'17',
						deliveryPrice:'3',
						distance:'400m'
					},
					{
						picUrl:require('../../static/image/index/shop4.jpg'),
						title:'古法秘制酱香猪蹄',
						score:'4.9',
						sale:'401',
						price:'17',
						deliveryPrice:'3',
						distance:'400m'
					},
				]
			}
		},
		onLoad() {

		},
		methods: {
			toSearch(){
				uni.navigateTo({
					url:'/pages/search/search'
				})
			},
			toShopList(item){
				uni.navigateTo({
					url:'/pages/shop/shop'
				})
			},
			toShopDetail(item){
				uni.navigateTo({
					url:'/pages/shop/detail'
				})
			}
		}
	}
</script>

<style lang="scss">
	.index_hd{
		width: 100%;
		height: 400rpx;
		padding: 70rpx 32rpx 0;
		background: linear-gradient(180deg, rgba(0, 116, 255, 1) 12.5%, rgba(133, 188, 255, 1) 100%);
		
		.navigation{
			text-align: center;
			color: #fff;
			font-size: 36rpx;
			font-weight: 500;
		}
		
		.search{
			display: flex;
			align-items: center;
			width: 100%;
			height: 80rpx;
			border-radius: 80rpx;
			padding: 0 24rpx;
			margin-top: 20rpx;
			background: rgba(255, 255, 255, 0.84);
			image{
				width: 28rpx;
				height: 30rpx;
			}
			input{
				margin-left: 16rpx;
				font-size: 26rpx;
				color: #333;
				&.placeholder{
					color: #9098A0;
				}
			}
		}
	}
	.index_con{
		padding: 40rpx 32rpx 180rpx;
		border-radius: 32rpx 32rpx 0 0;
		background-color: #fff;
		margin-top: -120rpx;
		.index_types{
			display: flex;
			align-items: center;
			justify-content: space-between;
			.index_type{
				display: flex;
				flex-direction: column;
				align-items: center;
				image{
					width: 96rpx;
					height: 96rpx;
					margin-bottom: 16rpx;
				}
				text{
					font-size: 24rpx;
					color: #2E343A;
				}
			}
		}
		.platform_notice{
			position: relative;
			display: flex;
			align-items: center;
			margin-top: 24rpx;
			height: 82rpx;
			border-radius: 12rpx;
			padding: 0 24rpx;
			background-color: #F8F8F8;
			color: #666;
			.notice_title{
				font-size: 28rpx;
				font-weight: 700;
				margin-right: 15rpx;
				flex-shrink: 0;
				color: #000000;
				text{
					color: #2588FF;	
				}
			}
			.notice_content{
				margin-left: 20rpx;
				font-size: 24rpx;
				color: #2E343A;
			}
			.notice_more{
				position: absolute;
				right: 24rpx;
			}
		}
		
		.adv{
			height: 182rpx;
			margin-top: 26rpx;
			image{
				border-radius: 12rpx;
				width: 100%;
				height: 100%;
			}
		}
	
		.stores{
			margin-top: 26rpx;
			.store{
				position: relative;
				display: flex;
				margin-bottom: 20rpx;
				.store_img{
					width: 130rpx;
					height: 130rpx;
					image{
						width: 100%;
						height: 100%;
					}
				}
				.store_info{
					margin-left: 24rpx;
					.store_info_title{
						font-size: 28rpx;
						font-weight: 700;
						color: #333;
					}
					.store_info_bd{
						display: flex;
						align-items: center;
						margin-top: 6rpx;
						.store_info_score{
							color: #2588FF;
							font-size: 28rpx;
							margin-right: 10rpx;
						}
						.store_info_sale{
							color: #9098A0;
							font-size: 28rpx;
						}
					}
					.store_info_bt{
						display: flex;
						align-items: center;
						margin-top: 6rpx;
						.store_info_price{
							color: #9098A0;
							font-size: 24rpx;
							margin-right: 10rpx;
						}
						.store_info_deliveryPrice{
							color: #9098A0;
							font-size: 24rpx;
						}
					}
					.store_info_distance{
						position: absolute;
						bottom: 0;
						right: 24rpx;
						color: #9098A0;
						font-size: 24rpx;
					}
				}
			}
		}
	}
</style>
